use std::cmp::max_by;

struct Solution {}

impl Solution {
  pub fn max_depth(s: String) -> i32 {
    let mut co = 0;
    let mut ret = 0;
    s.chars().for_each(|c| {
      match c {
        '(' => {
          co += 1;
          if co > ret {
            ret = co;
          }
        }
        ')' => {
          co -= 1;
        }
        _ => {}
      }
    });    
    ret  
  }
}